//var baseUrl = "http://localhost:8080/";
//Y-m-d H:i:s

// 将时间戳改成年月日时分秒·Y-m-d H:i:s
var dates = function(ms) {
	var time = new Date(ms);
	var y = time.getFullYear() + "";// 年
	var m = time.getMonth() + 1 + "";// 月
	var d = time.getDate() + "";// 日
	var h = time.getHours() + "";// 时
	var mm = time.getMinutes() + "";// 分
	var s = time.getSeconds() + "";// 秒
	if (m.length == 1) {
		m = "0" + m;
	}
	if (d.length == 1) {
		d = "0" + d;
	}
	if (h.length == 1) {
		h = "0" + h;
	}
	if (mm.length == 1) {
		mm = "0" + mm;
	}
	if (s.length == 1) {
		s = "0" + s;
	}
	return y + "-" + m + "-" + d + " " + h + ":" + mm + ":" + s;
};

// 将时间戳改成年月日时分秒·Y-m-d
var dates2 = function(ms) {
	var time = new Date(ms);
	var y = time.getFullYear() + "";// 年
	var m = time.getMonth() + 1 + "";// 月
	var d = time.getDate() + "";// 日
	if (m.length == 1) {
		m = "0" + m;
	}
	if (d.length == 1) {
		d = "0" + d;
	}
	return y + "-" + m + "-" + d;
};

// 将日期字符串改成时间戳
function getUnixTime(dateStr) {
	if (dateStr.length == 0) {
		return "";
	}
	var newstr = dateStr.replace(/-/g, '/');
	var date = new Date(newstr);
	var time_str = date.getTime().toString();
	return time_str;
}

/**
 * 判断变量是否空值undefined, null, '', false, 0, [], {} 均返回true，否则返回false
 * @param v
 * @returns {Boolean}
 */
function empty(v){
	switch (typeof v){
		case 'undefined' : return true;
		case 'string' : if(v.length == 0) return true; break;
		case 'boolean' : if(!v) return true; break;
		case 'number' : if(0 === v) return true; break;
		case 'object' :
			if(null === v) return true;
			if(undefined !== v.length && v.length==0) return true;
			for(var k in v){return false;} return true;
			break;
	}
	return false;
}
